//
//  MusicFMViewController.m
//  myMusicApp
//
//  Created by 11_wyq on 15/6/14.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "MusicFMViewController.h"
#import "FMPlayerVC.h"



@interface MusicFMViewController ()

@property (retain ,nonatomic) MBProgressHUD *MBP;

@end

@implementation MusicFMViewController

-(void)viewWillAppear:(BOOL)animated
{
    
}


- (void)viewDidLoad {
    [super viewDidLoad];
   
    
    UIView *view = [[[UIView alloc] initWithFrame:CGRectMake(0, 0,WIDTH * 100, HEIGHT * 30)]autorelease];
    [view setBackgroundColor:[UIColor clearColor]];
    self.navigationItem.titleView = view;
    UILabel *title = [[[UILabel alloc]initWithFrame:CGRectMake(WIDTH * 30, 0, WIDTH * 50,HEIGHT * 30)]autorelease];;
    title.text = @"首页";
    title.textColor = [UIColor whiteColor];
    [title setFont:[UIFont fontWithName:@"Helvetica-Bold" size:20]];//加粗字体
    [view addSubview:title];
    
    
    
    
    
    self.view.backgroundColor = [UIColor whiteColor];
    UIImage *image2 = [UIImage imageNamed:@"menu.png"];
    image2 = [image2 imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:image2 style:UIBarButtonItemStylePlain target:self action:@selector(locker)];
    
    
//    
    self.view.backgroundColor = [UIColor whiteColor];
    UIImage *image = [UIImage imageNamed:@"player2.png"];
    image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithImage:image style:UIBarButtonItemStylePlain target:self action:@selector(player2)];
//

    
    
   

    
    
    
    myMusicFMView *myMusicFMV = [[myMusicFMView alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
    [self.view addSubview:myMusicFMV];
    myMusicFMV.myDelegate = self;
    
    
    drawerViewController *drawer = [[drawerViewController alloc]init];
    drawer.view.frame = CGRectMake(- WIDTH, 0, WIDTH, HEIGHT);
    

    
   
    
}


-(void)player2
{
    FMPlayerVC *playerVC = [FMPlayerVC shareHandleController];
    NSLog(@"playerVC.trackId = %@",playerVC.trackId);
    if (playerVC.trackId == nil) {
        UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"提示" message:@"您当前没有听电台哟~~" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
        [alertView show];
        return;
        
    }
         
    [self.navigationController pushViewController:playerVC animated:YES];
        
   
}


-(void)locker
{
    [GiFHUD dismiss];//动态图隐藏
    //抽屉
    [self.sideMenuViewController presentLeftMenuViewController];
}

-(void)pushView:(NSString *)name
{
    FMtypeViewController *FMTypeVC = [[FMtypeViewController alloc]init];
    FMTypeVC.hidesBottomBarWhenPushed = YES;//隐藏下方Bar
    FMTypeVC.name = name;
    
    [self.navigationController pushViewController:FMTypeVC animated:YES];
    [FMTypeVC release];
}


-(void)pushPlayerView:(MusicFMModel *)model andNumber:(NSInteger)integer
{
    FMPlayerVC *playerVC = [FMPlayerVC shareHandleController];
    playerVC.trackId = model.trackId;
    playerVC.count = 1;
    playerVC.row = integer;
    NSLog(@"%@",model.trackId);
    [self.navigationController pushViewController:playerVC animated:YES];
    
    
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
